#include <iostream>
using namespace std;

namespace S1{
    int x=1;
    int f(){
        return x;
    }
    namespace S2{
        int x=2;
        int g(){
            return x;
        }
    }
}

int main(){
    using namespace S1;
    cout<<x<<endl;
    cout<<S2::x<<endl;
    cout<<S1::f()<<endl;
    cout<<S1::S2::g()<<endl;
    return 0;
}
